<template>
  <div class="main">
    <div class="main_one">
      <div class="left">
        <el-form ref="dataForm" class="form" :model="temp" label-position="right" label-width="90px">
          <el-form-item style="width: 200%;" label="来电号码:" prop="orderCode">
            <el-input v-model.trim="serach_phone" style="width: 250px;" placeholder="请输入" @keyup.enter.native="searchForPhone" />
            <el-button type="primary" icon="el-icon-search" @click="searchForPhone">查询</el-button>
          </el-form-item>
          <div class="moneyinfo">
            <span>余额:{{ cmsCodeData.cardSurplus?cmsCodeData.cardSurplus/100:"" }}</span>
            <span>积分:{{ temp.score }}</span>
            <span>押金:{{ temp.deposit?temp.deposit:'' }}</span>
            <span>最近安检:<span ref="anjian" v-html="checkDtStr" />  </span>
          <!-- <span>:{{}}</span> -->
          </div>
          <el-form-item style="" label="客户编号:" prop="csmCode">
            <el-input v-model="temp.csmCode" style="width: 100%;" :disabled="csmcodeFlag">
              <el-button v-if="!csmcodeFlag" slot="append" class="append-search" @click="getCmsCode(2)">获取</el-button>
            </el-input>
          </el-form-item>
          <el-form-item label="客户名称:" prop="csmName">
            <el-input v-model="temp.csmName" style="width: 100%;" placeholder="请输入" />
          </el-form-item>
          <el-form-item label="客户类型:" prop="csmType">
            <el-select v-model="temp.csmType" style="width: 100%;" placeholder="请选择">
              <el-option v-for="(l,i) in userType" :key="i" :value="l.value" :label="l.desc" />
            </el-select>
          </el-form-item>
          <el-form-item label="电话:" prop="contactPhone">
            <!-- <label slot="label">电&emsp;&emsp;话:</label> -->
            <el-input v-model="contactInfo.csmPhone" style="width: 100%;" />
          </el-form-item>
          <el-form-item label="联系人:" prop="contact">
            <el-input v-model="contactInfo.contact" style="width: 100%;" placeholder="请输入" />
          </el-form-item>
          <el-form-item label="所属机构:" prop="orgName">
            <el-tree-select
              ref="a"
              v-model="AddressData.orgSNNo"
              :clearable="false"
              class="tree-select"
              :popover-width="360"
              :select-params="{
                clearable: true,
                placeholder: '请选择组织机构',
                loading: $loadingPlugin.getTreeData
              }"
              :tree-params=" {
                'default-expand-all': true,
                'expand-on-click-node': false,
                'highlight-current': true,
                props:{
                  value:'orgSNNo',
                  label: 'orgName',
                  disabled: 'disabled',
                },
                data: orgTreeData
              }"
              @node-click="selectOrgTreeChange"
            />
          </el-form-item>
          <!-- <el-form-item style="width: 100%;" label="所在区域:" prop="orderCode">
            <el-cascader ref="cascader" :key="cascaderKey" v-model="AddressData.address" style="width: 27%;" :props="addressProps" clearable @change="selectCascader" />
            <el-input v-model="AddressData.csmAddress" style="width: 50%;" placeholder="请输入详细地址" @change="temp.csmId=null" />
            <el-input v-model="AddressData.csmFloor" style="width: 50px;" placeholder="" />
            <span style="margin-left: 20px;">层</span>
          </el-form-item> -->
          <el-form-item style="width: 33%;" label="所在区域:" prop="orderCode">
            <el-cascader ref="cascader" :key="cascaderKey" v-model="AddressData.address" style="width: 100%;" :props="addressProps" clearable @change="selectCascader" />
          </el-form-item>
          <el-form-item style="width: 57%;" label="" label-width="0" prop="orderCode">
            <el-input v-model="AddressData.csmAddress" style="width: 100%;" placeholder="请输入详细地址" @change="temp.csmId=null" />
          </el-form-item>
          <el-form-item style="width: 5%;" label="" label-width="0" prop="orderCode">
            <el-input v-model="AddressData.csmFloor" style="width: 100%;" placeholder="" />
          </el-form-item>
          <el-form-item style="width: 5%;" label="" label-width="0" prop="orderCode">
            <span style="margin-left: 20px;">层</span>
          </el-form-item>
          <el-form-item label="身份证号:" prop="sfzh">
            <el-input v-model="temp.sfzh" style="width: 100%;" placeholder="请输入" />
          </el-form-item>
          <el-form-item v-if="businessLicense&&(temp.csmType===2||temp.csmType===4)" label=" 营业执照:" prop="zzbh">
            <el-input v-model="temp.zzbh" style="width: 100%;" placeholder="请输入" />
          </el-form-item>
          <el-form-item label="销售员:" prop="saleMan">
            <el-input v-model="temp.saleMan" style="width: 100%;" placeholder="请输入" clearable disabled>
              <el-button v-if="!temp.saleMan" slot="append" class="append-search" @click="openInsure">查询</el-button>
              <el-button v-else slot="append" class="append-search" @click="temp.saleMan=''">清除</el-button>
            </el-input>
          </el-form-item>
          <el-form-item label-width="90px" label="客户备注:" prop="remark" style="width: 70%;" class="block">
            <el-input v-model="temp.remark" style="color: red;" type="textarea" :rows="2" maxlength="255" show-word-limit />
          </el-form-item>
          <el-form-item label-width="0" style="display: flex; width: 30%; flex-direction: row-reverse;">
            <el-button style="margin-top: 10px;" type="primary" icon="" @click="saveUser">保存客户</el-button>
          </el-form-item>
        </el-form>
        <div class="cardBox_phone" style="display: flex;">
          <el-card class="box-card" style="width: 40%; margin-right: 10px;">
            <div slot="header" class="clearfix">
              <span>关联电话</span>
            </div>
            <div style=" height: 110px; max-height: 110px; overflow: auto;">
              <div ref="selectPhone">
                <span v-for="(l,i) in phoneItems" :key="i" class="text item" @click="selectPhone(i,l)">
                  <div>
                    <span style="margin-right: 5px;">{{ l.csmPhone }}</span>
                    <span>{{ l.contact }}</span>
                  </div>
                  <!-- <el-button style="border:0;color:red" circle icon="el-icon-close" /> -->
                  <span v-if="i!==selectPhoneIndex">   <i class="el-icon-close" style="color: red;" @click.stop="delPhone(l,i)" />&nbsp;&nbsp;</span>
                </span>
              </div>
            </div>
          </el-card>
          <el-card class="box-card border" style="width: 60%;">
            <div slot="header" class="clearfix">
              <span>关联地址</span>
            </div>
            <div style="  height: 110px; max-height: 110px; overflow: auto;">
              <ul ref="selectAddress">
                <li v-for="(l,i) in addressItems" :key="i" class="text item" @click="selectAddress(i,l)">
                  <div>
                    <span>{{ l.csmAddress }}</span>
                  </div>
                  <span><i class="el-icon-close" style="color: red;" @click.stop="delAddress(l,i)" /> &nbsp;&nbsp;</span>
                </li>
              </ul>
            </div>
          </el-card>
        </div>
        <keep-alive>
          <div class="tabs_content">
            <el-tabs v-model="TabsActiveName" :tab-position="'left'" type="border-card" style="height: 240px; margin-top: 10px;" @tab-click="handleClick">
              <el-tab-pane label="订购" name="dingGou">
                <div style="">
                  <el-form ref="form" size="mini" label-width="90px" class="orderForm" :model="orderForm">
                    <el-form-item style="width: 20%;" label="" prop="" label-width="0">
                      <el-radio-group v-model="orderForm.orderFlag">
                        <el-radio :label="1">购买</el-radio>
                        <el-radio :label="2">兑换</el-radio>
                      </el-radio-group>
                    </el-form-item>
                    <!-- <el-form-item label="商品分类:" prop="address">
                      <el-select v-model="orderForm.goodsType" placeholder="请选择">
                        <el-option :value="1" label="地址1" />
                        <el-option :value="2" label="地址2" />
                        <el-option :value="3" label="地址3" />
                      </el-select>
                    </el-form-item> -->
                    <el-form-item style="width: 35%;" label="商品分类:" prop="orgSNNo">
                      <el-tree-select
                        v-model="orderForm.gtId"
                        style="width: 100%;"
                        :clearable="false"
                        class="tree-select"
                        :popover-width="300"
                        :select-params="{
                          clearable: true,
                          placeholder: '请选择商品分类',
                          loading: $loadingPlugin.getTreeData
                        }"
                        :tree-params=" {
                          'default-expand-all': true,
                          'expand-on-click-node': false,
                          'highlight-current': true,
                          props:{
                            value:'gtId',
                            label: 'gtName',
                            disabled: 'disabled',
                          },
                          data: goodsTreeDataDeatil
                        }"
                        @node-click="selectTreeChange"
                      />
                    </el-form-item>
                    <el-form-item style="width: 35%;" label="商品名称:">
                      <el-select v-model="orderForm.goodsId" style="width: 100%; margin-right: 2px;">
                        <el-option v-for="(l,i) in goodsTypesDetailList" :key="i" :value="l.goodsId" :label="l.goodsName" />
                      </el-select>
                    </el-form-item>
                    <!-- <el-form-item label="商品名称:" prop="address">
                      <el-select v-model="orderForm.goodName" placeholder="请选择">
                        <el-option :value="1" label="地址1" />
                        <el-option :value="2" label="地址2" />
                        <el-option :value="3" label="地址3" />
                      </el-select>
                    </el-form-item> -->
                    <el-form-item style="display: flex; flex-direction: row-reverse; width: 10%;" label-width="20px">
                      <el-button type="primary" icon="el-icon-plus" @click="addGoods">添加</el-button>
                    </el-form-item>
                  </el-form>
                  <lb-table
                    v-show="orderForm.orderFlag===1"
                    ref="lbTable"
                    class="tableOrder"
                    :summary-method="getSummaries"
                    show-summary
                    highlight-current-row
                    max-height="400"
                    element-loading-text="加载中"
                    :column="tableData.column"
                    :data="tableData.data"
                    :pagination="false"
                  />
                  <lb-table
                    v-show="orderForm.orderFlag===2"
                    ref="lbTable1"
                    class="tableOrder"
                    :summary-method="getSummaries"
                    show-summary
                    highlight-current-row
                    max-height="400"
                    element-loading-text="加载中"
                    :column="tableDataScore.column"
                    :data="tableDataScore.data"
                    :pagination="false"
                  />
                  <p style="margin-top: 5px;"> 备注: </p>
                  <el-input v-model="submitForm.remark" style="margin-top: 5px;" type="textarea" :rows="3" maxlength="255" show-word-limit />
                </div>
              </el-tab-pane>
              <el-tab-pane lazy label="报修" name="baoXiu">
                <Repairs ref="baoXiu" :csm-id="temp.csmId" :open-flow="openOhtersFlow" :open-urge="openUrge" :parse-time="parseTime" />
              </el-tab-pane>
              <el-tab-pane lazy label="退瓶" name="tuiPing">
                <BottleReturn ref="tuiPing" :open-flow="openOhtersFlow" :parse-time="parseTime" :open-urge="openUrge" :open-back-order="openBackOrder" />
              </el-tab-pane>
              <el-tab-pane lazy label="信息" name="xinXi">
                <Message ref="xinXi" :open-flow="openFlow" :parse-time="parseTime" :open-urge="openUrge" :open-back-order="openBackOrder" />
              </el-tab-pane>
              <el-tab-pane lazy label="投诉" name="touSu">
                <Complaint ref="touSu" :open-flow="openOhtersFlow" :parse-time="parseTime" :open-urge="openUrge" :open-back-order="openBackOrder" />
              </el-tab-pane>
              <el-tab-pane lazy label="其他" name="qiTa">
                <Other ref="qiTa" :parse-time="parseTime" />
              </el-tab-pane>
            </el-tabs>
          </div>
        </keep-alive>
      </div>

      <div class="right">
        <!-- <div><i class="el-icon-s-tools Setiing" @click="$refs.setting.open()" /> </div> -->
        <el-card class="chit_card cardBox_phone">
          <div slot="header" class="clearfix">
            <span>保险信息</span>
            <i style="float: right; padding: 3px 0;" class="el-icon-caret-bottom" @click="fold('car_main')" />
          </div>
          <div ref="car_main" class="card_main" style="padding: 0 5px;">
            <el-form ref="dataFormRight" class="" :model="temp" label-position="right" label-width="80px">
              <el-form-item style="margin-top: 10px;" label="保险时间:" prop="insurance">
                <el-date-picker
                  v-model="temp.insurance"
                  style="width: 100%;"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                />
              </el-form-item>
              <div style="display: flex; align-items: center;">
                <el-form-item style="width: 60%;" label="保险单号:" prop="orderCode">
                  <el-input v-model="temp.insureCode" placeholder="请输入">
                    <el-button slot="append" class="append-search" @click="getCmsCode(10)">查询</el-button>
                  </el-input>
                </el-form-item>
                <el-form-item label="售保人:" style="width: 40%;" prop="insuranceMan">
                  <el-input v-model="temp.insuranceMan" placeholder="请输入">
                  <!-- <el-button slot="append" class="append-search">查询</el-button> -->
                  </el-input>
                </el-form-item>
              </div>
            </el-form>
          </div>
        </el-card>
        <el-card class="chit_card cardBox_phone cardBox_order">
          <div slot="header" class="clearfix">
            <span>最近三次订购记录</span>
            <span class="midOrder">订气总数:{{ temp.totalGasCount }}</span>
            <i style="float: right; padding: 3px 0;" class="el-icon-caret-bottom" @click="fold('order')" />
            <!-- <el-button style="float: right; padding: 3px 0;" type="text" @click="fold('order')">操作按钮</el-button> -->
          </div>
          <div ref="order" class="card_main">
            <div style=" height: 100%; overflow: auto;">
              <ul>
                <li class="likeTables">
                  <span class="one">订单号</span>
                  <span class="two">商品</span>
                  <span class="three">下单日期</span>
                  <span class="four">操作</span>
                </li>
                <li v-for="(l,i) in cmstop3" :key="i" class="likeTables">
                  <span class="one moduletitle">
                    <el-link :title="l.orderCode" size="mini" type="info">
                      {{ l.orderCode }}
                    </el-link>
                  </span>
                  <span class="two moduletitle"><span style="width: 100%;" :title="l.goodsDesc">{{ l.goodsDesc }}   <span style="color: green;"> X {{ l.goodsCount }}</span></span> </span>
                  <span class="three moduletitle">{{ l.modifyTime&&parseTime(l.modifyTime,'{y}-{m}-{d}') }}</span>
                  <span class="four ">
                    <el-link v-if="l.orderStatus!==7" size="mini" type="primary" @click="openUrge({ billCode: l.orderCode, billType: 1 })">
                      催气
                    </el-link>
                    <el-link v-if="l.orderStatus!==7" size="mini" type="primary" @click="openBackOrder(l)">
                      退单
                    </el-link>
                    <el-link size="mini" type="primary" @click="openFlow(l)">
                      流转
                    </el-link>
                  </span>
                </li>
              </ul>
            </div>
          </div>
        </el-card>
        <el-card class="chit_card cardBox_phone cardBox_shortcut">
          <div slot="header" class="clearfix">
            <span>快捷查询</span>
            <i style="float: right; padding: 3px 0;" class="el-icon-caret-bottom" @click="fold('shortcut')" />
            <!-- <el-button style="float: right; padding: 3px 0;" type="text" @click="fold('shortcut')">操作按钮</el-button> -->
          </div>
          <div ref="shortcut" class="card_main_shortcut fastSearchstyle">
            <div style=" height: 100%; padding: 5px; overflow: auto;10px">
              <el-form ref="shortcut" style="display: flex; flex-wrap: wrap;" class="form2" :model="shortcutParams" label-position="right" label-width="80px">
                <el-form-item style="width: 100%;" label="条件类型:" prop="csmPhone">
                  <el-input v-model.trim="shortcutParams.csmPhone" class="input-with-select" placeholder="请输入">
                    <el-select slot="prepend" v-model="shortcutParams.select" style="width: 100px;" placeholder="请选择">
                      <el-option label="客户电话" :value="1" />
                      <el-option label="客户名称" :value="2" />
                      <el-option label="客户编码" :value="3" />
                      <el-option label="身份证" :value="4" />
                      <el-option label="使用证" :value="5" />
                      <el-option label="充值卡" :value="6" />
                    </el-select>
                  <!-- <el-button slot="append" class="append-search">查询</el-button> -->
                  </el-input>
                </el-form-item>
                <el-form-item style="width: 80%;" label="客户地址:" prop="cmsAddress">
                  <el-input v-model="shortcutParams.cmsAddress" placeholder="请输入" />

                  <!-- <el-button type="primary" icon="el-icon-search" @click="fastSearch">快速查询</el-button> -->

                </el-form-item>
                <el-form-item style="width: 20%;" label="" label-width="0">

                  <el-button style="width: 100%;" type="primary" icon="el-icon-search" @click="fastSearch">快速查询</el-button>

                </el-form-item>
              </el-form>
              <div class="fontItem">
                结果信息栏 --仅显示前100条
              </div>
              <ul ref="checkRadio">
                <li v-for="(l,i) in qkparams" :key="i" class="shortcut" style="margin: 5px 0;">
                  <el-radio v-model="radio1" class="shortcut_left" :label="i" @change="changeRadio" />
                  <div class="shortcut_right">
                    <div>{{ l.csmRgPhone }}({{ l.csmName }}) &nbsp; <span>编号:{{ l.csmCode }}</span> </div>
                    <div> {{ l.csmRgAddress }}</div>
                  </div>
                </li>
              </ul>
            </div>
          </div>
        </el-card>
      </div>

    </div>

    <footer v-show="TabsActiveName!=='xinXi'" class="footer">
      <div class="left">
        <el-form ref="submitForm" class="footer_form" label-position="right" label-width="80px" size="mini" :model="submitForm">
          <el-form-item label="责任机构:" prop="orgName">
            <el-tree-select
              v-model="submitForm.orgSNNo"
              :clearable="false"
              class="tree-select"
              :popover-width="360"
              :select-params="{
                clearable: true,
                placeholder: '请选择组织机构',
                loading: $loadingPlugin.getTreeData
              }"
              :tree-params=" {
                'default-expand-all': true,
                'expand-on-click-node': false,
                'highlight-current': true,
                props:{
                  value:'orgSNNo',
                  label: 'orgName',
                  disabled: 'disabled',
                },
                data: orgTreeData
              }"
              @node-click="SubmitSelectOrgTreeChange"
            />
          </el-form-item>
          <el-form-item label="处理人:" prop="address">
            <el-select v-model="submitForm.ownerId" placeholder="请选择">
              <el-option v-for="l in userData" :key="l.userId" :value="l.userId" :label="l.userName" />
            </el-select>
          </el-form-item>
          <el-form-item v-if="TabsActiveName!=='touSu'&& PageOpitonsFn('预约')" class="yuyueriqi" label="预约时间:" prop="appointment">
            <el-date-picker
              v-model="submitForm.appointment"
              style="width: 100%;"
              type="date"
              placeholder="选择日期"
            />
          </el-form-item>
          <el-form-item v-if="TabsActiveName!=='touSu'&& PageOpitonsFn('预约')" class="yuyueshijian" label=" " label-width="0" prop="appointment">
            <el-time-picker
              v-model="submitForm.time"
              is-range
              range-separator="至"
              start-placeholder="开始时间"
              end-placeholder="结束时间"
              placeholder="选择时间范围"
            />
          </el-form-item>

          <!-- <template v-slot:btns>
          <el-button type="primary" icon="el-icon-plus" @click="addGoods">添加</el-button>
        </template> -->
        </el-form>
        <div v-if="TabsActiveName=='dingGou'">
          <!-- <el-checkbox-group v-model="submitForm.checkList"> -->
          <el-checkbox v-if="PageOpitonsFn('加急')" v-model="submitForm.checkList.isUrgent" label="1">加急</el-checkbox>
          <el-checkbox v-if="PageOpitonsFn('需发票')" v-model="submitForm.checkList.isInvoice" label="1">需发票</el-checkbox>
          <el-checkbox v-if="PageOpitonsFn('自提')" v-model="submitForm.checkList.isPickUp" label="1">自提</el-checkbox>
          <el-checkbox v-if="PageOpitonsFn('补单')" v-model="submitForm.checkList.isRemedy" label="1">补单</el-checkbox>
          <el-checkbox v-if="PageOpitonsFn('月结')" v-model="submitForm.checkList.settlementType_monthly" label="1">月结</el-checkbox>
          <el-checkbox v-if="PageOpitonsFn('需回执')" v-model="submitForm.checkList.isRe" :disabled="HuiZhiFlag" label="1">需回执</el-checkbox>
          <el-checkbox v-if="PageOpitonsFn('托管')" v-model="submitForm.checkList.isZb" label="1">托管</el-checkbox>
          <el-checkbox v-if="anjianInfo!==1" v-model="submitForm.checkList.gasCheck" label="1">安检</el-checkbox>
          <span v-if="anjianInfo!==1" style="margin-left: 5px; font-size: 12px; color: #4b4cff;">勾选此项将向处理人下达一条定期安检任务单</span>
          <span v-else style="margin-left: 5px; font-size: 12px; color: #4b4cff;">已下达安检任务单</span>
          <!-- </el-checkbox-group> -->
        </div>
      </div>
      <div v-if="TabsActiveName=='dingGou'" class="right_btns">
        <el-button style="margin-left: 10px;" type="primary" @click="submitOrderKeep">提交并继续（Shift+s）</el-button>
        <el-button type="primary" @click="submitOrder">提交订单（Shift+w）</el-button>
      </div>
      <div v-if="TabsActiveName=='baoXiu'" class="right_btns">
        <el-button type="primary" @click="submitOrderBaoXiu">提交报修登记</el-button>
      </div>
      <div v-if="TabsActiveName=='touSu'" class="right_btns">
        <el-button type="primary" @click="submitOrderOthers('touSu','投诉')">提交投诉登记</el-button>
      </div>
      <div v-if="TabsActiveName=='tuiPing'" class="right_btns">
        <el-button type="primary" @click="submitOrderTuiPing">提交退瓶登记</el-button>
      </div>
      <div v-if="TabsActiveName=='qiTa'" class="right_btns">
        <el-button type="primary" @click="submitOrderOthers('qiTa','业务描述')">提交</el-button>
      </div>
    </footer>
    <Urge ref="urge" />
    <BackOrder ref="backOrder" :get3order-history="get3orderHistory" />
    <backOrderApply ref="backOrderApply" :get3order-history="get3orderHistory" />
    <Flow ref="flow" />
    <setting ref="setting" />
    <insure ref="insure" :org-tree-data="orgTreeData" :user-type="userType" @changeSaleMan="changeSaleMan" />
    <OhtersFlow ref="OhtersFlow" />
  </div>
</template>

<script>
  // import phoneData from './phone'
  // import cmsCodeData from './cmsCard'
  // import cmstop3 from './cmstop3'
  // import qkparams from './qkparams'
  import { parseTime } from '@/utils'
  import getTreeData from '@/utils/jsonTree'
  import { mapGetters } from 'vuex'
  import { phoneOrderCallorderSetting, selectAreaCode, queryCsmTypeMap, phoneOrderSearchCms, phoneOrderServePrice, phoneOrdersumitRepair, getCodeNum, phoneOrderSubmit, searchOrgidList, phoneOrderFastSearch, phoneOrderFloorfee, phoneOrderGoodsPrices, goodsTypeQueryList, phoneOrderAreaprice, phoneOrderSearchspecialPrice, goodsTypeDetail, phoneOrderby3order, phoneOrderSearchLastOrder, phoneOrderDepositOrder, phoneOrderSaveUser, phoneOrderDelPhone, phoneOrderDelAddress, phoneOrderCsmGasCheck, phoneOrdersearchScore, phoneOrdersumitGiveback, phoneOrdersumitComplain, phoneOrdersumitOrderOther, queryOrderbillReturnParam } from '@/api'
  import { mergeAsyncFunc } from '@/utils/mergeAsyncFunc'
  export default {
    name: 'phoneOrder',
    components: {
      Repairs: require('./components/repairs.vue').default,
      BottleReturn: require('./components/bottleReturn.vue').default,
      Message: require('./components/message.vue').default,
      Complaint: require('./components/complaint.vue').default,
      Other: require('./components/other.vue').default,
      Urge: require('../../components/PressOrderModal').default,
      BackOrderApply: require('../../orderCenter/orderManage/components/BackOrderApply.vue').default,
      BackOrder: require('../../orderCenter/orderManage/components/BackOrder.vue').default,
      Flow: require('../../components/OrderFlowInfoModal').default,
      OhtersFlow: require('./Dialog/flow.vue').default,
      setting: require('./components/setting.vue').default,
      insure: require('./components/insure.vue').default
    },
    data() {
      return {
        name: 'phoneOrder',
        radio1: null,
        TabsActiveName: 'dingGou',
        PageOpitons: [], // 下方的加急，回执等 选项配置
        businessLicense: false, // 系统配置  zzbh开启
        userType: [],
        serach_phone: null,
        selectPhoneIndex: null, // 用于是否删除关联电话
        goodsTreeData: [],
        goodsTreeDataDeatil: [],
        csmcodeFlag: false,
        orgTreeData: [],
        goodsTypesDetailList: [],
        cascaderKey: 1,

        mainGoodsPrices: [], // 主营商品价格
        AreapriceList: [], // 区域价格
        ServePriceList: [], // 服务费
        FloorfeeList: [], // 上楼费
        orgId: null, // 组织id
        userData: [], // 处理人列表
        orgData: {}, // 当前机构对象数据
        AddressData: {}, // 联系人地址信息
        contactInfo: {}, // 联系人详细信息
        contactData: {}, // 联系人电话和地址信息 存本地
        addressCascader: {}, // 级联选择对象
        checkDtStr: '', // 安检提示信息
        anjianInfo: null, // 安检勾选判断   来自后端
        HuiZhiFlag: false, // 回执勾选判断   来自sp2
        rules: {
          sfzh: [{ required: true, message: '请输入正确的身份证号', trigger: 'change', pattern: /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/ }],
          zzbh: [{ required: true, message: '请输入资质编号', trigger: 'change' }],
          saleMan: [{ required: true, message: '请选择销售员', trigger: 'change' }],
          insurance: [{ required: true, message: '请选择保险时间', trigger: 'blur' }],
          insuranceMan: [{ required: true, message: '请输入售保人', trigger: 'change' }]
        },
        settingList: {
          // 身份证 sfzh 营业执照 zzbh 销售员 saleMan 保险 insurance  售保人 insuranceMan
          sfzh: true,
          zzbh: true,
          saleMan: true,
          insurance: true,
          insuranceMan: true
        },
        addressProps: {
          lazy: true,
          checkStrictly: true,
          lazyLoad(node, resolve) {
            const { level, value } = node
            mergeAsyncFunc(selectAreaCode, { areaCode: value || 0 })
              .then((res) => {
                const nodes = res.data.map(item => ({
                  value: item.areaCode,
                  label: item.areaName,
                  leaf: level >= 3
                }))
                resolve(nodes)
              })
              .catch(() => {
                node.loading = false
                node.loaded = false
              })
          }
        },
        temp: {
          'fromPlat': 1,
          'csmId': null,
          'csmCode': null,
          'csmName': null,
          'csmPhone': null,
          'contactPhone': null,
          'isPickUp': null,
          'contact': null,
          'csmAddressId': null,
          'csmAddress': null,
          'intSpare5': null,
          'csmType': 1,
          'strSpare2': null,
          'saleMan': null,
          'lon': null,
          'lat': null,
          'orgId': null,
          'orgSNNo': null,
          'orgName': null,
          'ownerId': null,
          'ownerCode': null,
          'ownerName': null,
          'isUrgent': null,
          'isInvoice': null,
          'paymentMethod': null,
          'reStatus': null,
          'intSpare1': null,
          'remark': null,
          'orderFlag': null
        },
        shortcutParams: {
          select: 1,
          csmPhone: null
        },
        orderForm: {
          orderFlag: null,
          goodsId: null
        },
        submitForm: {
          checkList: {}
        },
        tableData: {
          column: [
            {
              prop: 'goodsName', label: '商品', align: 'center', width: 180, fixed: true
            },
            {
              prop: 'gprince', label: '市价', align: 'center', width: '',
              render: (h, { row, $index, column }) => {
                return (
                <div>
                  {row._edit ? (
                    <el-input class='EditInp' size='mini' value={row[column.property] } style='width: 80px' onBlur={(val) => { this.blurInput(row, column, val) }} onInput={(val) => { this.changeInput(row, column, val) }}> </el-input>
                  ) : (<span >{row[column.property] ? (row[column.property] * 1).toFixed(2) : 0}</span>)}
                </div>
              )
              }
            },
            {
              prop: 'definePrice', label: '特价', align: 'center', width: 80,
              render: (h, { row, $index }) => <span>{row.definePrice ? row.definePrice : 0}</span>
            },
            {
              prop: 'gprefPrice', label: '优惠', align: 'center', width: '80',
              render: (h, { row, $index, column }) => {
                return (
                <div>
                  {row._edit ? (
                    <el-input class='EditInp' size='mini' value={row[column.property] } style='width: 80px' onBlur={(val) => { this.blurInput(row, column, val) }} onInput={(val) => { this.changeInput(row, column, val) }}> </el-input>
                  ) : (<span >{row[column.property] ? (row[column.property] * 1).toFixed(2) : 0}</span>)}
                </div>
              )
              }
            },
            {
              prop: 'gcount', label: '数量', width: 100,
              render: (h, { row, $index, column }) => {
                return (
                <div>
                  {row._edit ? (
                    <el-input class='EditInp' size='mini' value={row[column.property] } style='width: 80px' onBlur={(val) => { this.blurInput(row, column, val) }} onInput={(val) => { this.changeInput(row, column, val) }}> </el-input>
                  ) : (<span >{row[column.property] ? (row[column.property] * 1) : ''}</span>)}
                </div>
              )
              }
              // render: (h, { row, $index }) => <el-input onBlur={(val)=>{this.blurInput(row,column,val)}} oninput={(e) => this.changeNum(row, $index, e)} v-model={row.gcount}></el-input>
            },
            {
              prop: 'fee1', label: '配送费', align: 'center', width: 80,
              render: (h, { row, $index, column }) => {
                return (
                <div>
                  {row._edit ? (
                    <el-input class='EditInp' size='mini' value={row[column.property] } style='width: 80px' onBlur={(val) => { this.blurInput(row, column, val) }} onInput={(val) => { this.changeInput(row, column, val) }}> </el-input>
                  ) : (<span >{row[column.property] ? (row[column.property] * 1).toFixed(2) : ''}</span>)}
                </div>
              )
              }
            },
            {
              prop: 'fee2', label: '上楼费', align: 'center', width: 80,
              render: (h, { row, $index, column }) => {
                return (
                <div>
                  {row._edit ? (
                    <el-input class='EditInp' size='mini' value={row[column.property] } style='width: 80px' onBlur={(val) => { this.blurInput(row, column, val) }} onInput={(val) => { this.changeInput(row, column, val) }}> </el-input>
                  ) : (<span >{row[column.property] ? (row[column.property] * 1).toFixed(2) : ''}</span>)}
                </div>
              )
              }
            },
            {
              prop: 'tip', label: '服务费', align: 'center', width: 80,
              render: (h, { row, $index, column }) => {
                return (
                <div>
                  {row._edit ? (
                    <el-input class='EditInp' size='mini' value={row[column.property] } style='width: 80px' onBlur={(val) => { this.blurInput(row, column, val) }} onInput={(val) => { this.changeInput(row, column, val) }}> </el-input>
                  ) : (<span >{row[column.property] ? (row[column.property] * 1).toFixed(2) : ''}</span>)}
                </div>
              )
              }
              // render: (h, { row }) => <el-link onClick={() => this.openDetail(row)}>{row.orderCode}</el-link>
            },
            {
              prop: 'receivable', label: '总应收', align: 'center', width: 100,
              render: (h, { row }) => <span >{this.goodsPrice(row)}</span>
            },
            {
              prop: '', label: '', align: 'center', width: '200',
              // render: (h, { row, $index }) => <span onClick={() => this.delGoods($index) }><i class='el-icon-close' style='color: red;' /></span>
              render: (h, { row, $index }) => {
                return (
                <div>
                    <el-link size='mini' onClick={() => this.handleEdit(row)}>
                      {row._edit ? '' : '编辑'}
                    </el-link>
                    <el-link size='mini' onClick={() => this.handleSave(row) } >
                      {row._edit ? '保存' : ''}
                    </el-link>
                    <el-link size='mini' onClick={() => this.delGoods($index)}>
                      删除
                    </el-link>

                  </div>
                )
              }
            }

          ],
          data: []
        },
        tableDataScore: {
          column: [
            { label: '商品', prop: 'goodsName', width: 230 },
            { label: '单品积分', prop: 'priceScore', width: 80, align: 'right' },
            { label: '数量', prop: 'gcount', width: 50, align: 'right',
              render: (h, { row, $index, column }) => {
                return (
                <div>
                  {row._edit ? (
                    <el-input class='EditInp' size='mini' value={row[column.property] } style='width: 80px' onBlur={(val) => { this.blurInput(row, column, val) }} onInput={(val) => { this.changeInput(row, column, val) }}> </el-input>
                  ) : (<span >{row[column.property] ? (row[column.property] * 1) : ''}</span>)}
                </div>
              )
              }
            },
            // { label: '现有库存', prop: 'storeCount', width: 80, align: 'right',, hidden: true },
            { label: '所需总积分', prop: 'requiredScore', width: 120, align: 'right',
              render: (h, { row }) => <span >{this.goodsScores(row)}</span>
            },
            {
              prop: '', label: '', align: 'center', width: '200',
              // render: (h, { row, $index }) => <span onClick={() => this.delGoods($index) }><i class='el-icon-close' style='color: red;' /></span>
              render: (h, { row, $index }) => {
                return (
                <div>
                    <el-link size='mini' onClick={() => this.handleEdit(row)}>
                      {row._edit ? '' : '编辑'}
                    </el-link>
                    <el-link size='mini' onClick={() => this.handleSave(row) } >
                      {row._edit ? '保存' : ''}
                    </el-link>
                    <el-link size='mini' onClick={() => this.delGoods($index)}>
                      删除
                    </el-link>

                  </div>
                )
              }
            }

          ],
          data: []
        },
        num: null,
        addressItems: [],
        phoneItems: [],
        phoneData: {},
        cmsCodeData: {},
        cmstop3: [], // 最近三次订购数据
        qkparams: [] // 结果信息栏数据

      }
    },
    computed: {
      ...mapGetters([
        'orgList',
        'corpSettingData'
      ])
    },
    watch: {
      // submitForm.orgSNNo
      'submitForm.orgSNNo': {// 深度监听，可监听到对象、数组的变化
        handler(val, oldVal) {
          // console.log(this.orgTreeData)
          // console.log(val)
          // var arr = this.orgTreeData.find(l => val === l.orgSNNo)
          // this.orgId = arr.orgId
          // this.search_OrgidList()
        },
        deep: true // true 深度监听
      },
      'temp.csmType': {// 深度监听，可监听到对象、数组的变化
        handler(val, oldVal) {
          // orderForm.orderFlag
          // console.log(val, oldVal)
          if (val === oldVal) return
          if (this.orderForm.orderFlag === 1) {
            this.$message.warning('客户类型发生变化对应的区域价格可能发生变化,商品需重新选择')
            this.tableData.data = []
            this.tableDataScore.data = []
          } else {
            this.$message.warning('客户类型发生变化对应的兑换所需积分可能发生变化,商品需重新选择')
            this.tableData.data = []
            this.tableDataScore.data = []
            this.getGoodsTypeDetails(this.orderForm.gtId)
          }
          // console.log(val, 'val')
        },
        deep: true, // true 深度监听
        immediate: false
      },
      'cascaderKey': {// 深度监听，可监听到对象、数组的变化
        handler(val, oldVal) {
          // 地址信息

        },
        deep: true // true 深度监听
      }
    },
    async  created() {
      if (this.corpSettingData.sp2 >> 27 & 0x01) {
        this.HuiZhiFlag = true
        this.submitForm.checkList.isRe = true
      }
      await this.getUserType()
      await this.getCallorderSetting()
      await this.getOrgTreeData()
      await this.getGoodsTreeData()
      await this.getGoodsPrices()
      await this.GetAreaprice()
      await this.GetServePrice()
      await this.GetFloorfee({})
    },
    mounted() {
      // const vm = this
      this.keyCodeForEvent()
      this.$watch('orderForm.orderFlag', (val) => {
        this.orderForm.gtId = null
        this.orderForm.goodsId = null
        this.tableData.data = []
        this.tableDataScore.data = []
        if (val === 1) {
          this.goodsTreeDataDeatil = this.goodsTreeData.filter(l => l.gtCategory === 1)
        } else if (val === 2) {
          this.goodsTreeDataDeatil = this.goodsTreeData.filter(l => l.gtCategory === 4)
        }
        // console.log(val, 'val')
      }, { deep: true })
    },
    methods: {
      parseTime,
      async getUserType() {
        try {
          const res = await queryCsmTypeMap()
          this.userType = res.data
        } catch (error) {
          console.log(error)
        }
      },
      // 查询窗体配置
      // phoneOrderCallorderSetting
      async getCallorderSetting() {
        try {
          const res = await phoneOrderCallorderSetting()
          // console.log(res, 'phoneOrderCallorderSetting')
          // console.log(JSON.parse(res.data.orderOptions), 'phoneOrderCallorderSetting')
          this.businessLicense = res.data.businessLicense
          this.PageOpitons = JSON.parse(res.data.orderOptions)
        } catch (e) {
          console.log(e)
        }
      },
      // 下方加急，回执等选项配置
      PageOpitonsFn(val) {
        if (this.PageOpitons.length > 0) {
          var obj = this.PageOpitons.find(l => l.keyName === val)
          var flag = false
          obj.keyStatus === 1 ? flag = false : flag = true
          return flag
        } else {
          return true
        }
      },
      // 获取用户编号
      async getCmsCode(type) {
        const res = await getCodeNum({ type })
        if (type === 2) {
          this.temp.csmCode = res.data
        } else if (type === 10) {
          this.temp.insureCode = res.data
        }
        // this.param
      },
      // 模拟组合键触发函数
      keyCodeForEvent() {
        const vm = this

        let code = 0
        let code2 = 0
        document.onkeydown = function(e) {
          const evn = e || event
          const key = evn.keyCode || evn.which || evn.charCode
          // console.log(key)
          if (key === 16) {
            code = 1
          }
          if (key === 83) {
            code2 = 1
          }
          if (key === 87) {
            code2 = 2
          }
          if (code === 1 && code2 === 1) {
            // alert('shift+S')
            vm.submitOrderKeep()
            // this obj to do something
            code = 0
            code2 = 0
          }
          if (code === 1 && code2 === 2) {
            // alert('shift+W')
            vm.submitOrder()
            // this obj to do something
            code = 0
            code2 = 0
          }
        }
        document.onkeyup = function(e) {
          if (e.keyCode === 16) {
            code = 0
          }
          if (e.keyCode === 83) {
            code2 = 0
          }
          if (e.keyCode === 87) {
            code2 = 0
          }
        }
      },
      async searchForPhone(flag = true, querycsmId) {
        // flag 为真时  表示是快捷查询
        // console.log(process.env.VUE_APP_PROXY_TARGET)
        // console.log(process.env.VUE_APP_BASE_API)
        this.orderForm.orderFlag = 1 // 默认切换到购买
        this.tableData.data = [] // 初始化订单表格
        let params = {}
        if (querycsmId) {
          params = { csmId: querycsmId, phone: '' }
        } else {
          params = { csmId: 0, phone: this.serach_phone }
        }
        const res = await phoneOrderSearchCms(params)
        this.phoneData = res.data
        if (!res.data) {
          this.$message.warning('没有查询到对应客户信息')
          this.temp = {
            csmType: 1
          }
          this.tableData.data = []
          this.addressItems = []
          this.phoneItems = []
          this.phoneData = {}
          this.cmsCodeData = {}
          this.cmstop3 = [] // 最近三次订购数据
          this.qkparams = [] // 结果信息栏数据
          this.AddressData = {} // 联系人地址信息
          this.contactInfo = {} // 联系人详细信息
          this.contactData = {} // 联系人电话和地址信息 存本地
          this.addressCascader = {} // 级联选择对象
          this.checkDtStr = '' // 安检提示信息
          this.anjianInfo = null // 安检勾选判断   来自后端
          return
        }
        this.phoneItems = this.phoneData.phoneItems.filter(l => l.cpStatus !== -1)
        this.addressItems = this.phoneData.addressItems
        this.$nextTick(function() {
          // 初始化关联地址选择
          if (this.addressItems.length === 1) {
            this.selectAddress(0, this.addressItems[0])
          } else {
            this.selectAddress()
          }
          // 初始化关联电话选择
          var dataitem = this.phoneItems.find(l => l.csmPhone === this.phoneData.csmRgPhone)
          var index = this.phoneItems.findIndex(l => l.csmPhone === this.phoneData.csmRgPhone)
          this.selectPhoneIndex = index
          // console.log(index, dataitem, '(index, dataitem)')
          this.selectPhone(index, dataitem)

          if (this.TabsActiveName !== 'dingGou') { // 当前在的tabs调接口更新数据
            this.$refs[this.TabsActiveName].getData(this.temp.csmId)
          }
        })
        this.temp = { ...this.phoneData }
        this.saveOrgData()
        this.get3orderHistory()
        // 通过电话获取到cmsCode
        var csmCode = this.phoneData.csmCode
        // console.log(csmCode)
        if (csmCode) {
          this.getDepositOrder()
        }
        this.csmcodeFlag = true
        if (flag) {
          // await this.getFastSearchInfo()
          this.shortcutParams.select = 1
          this.shortcutParams.csmPhone = this.serach_phone
          await this.fastSearch()
        }
      },
      // 查询上次订单
      async searchLastOrder(csmAddressId = '') {
        const params = {
          csmId: this.temp.csmId,
          csmAddressId
        }
        try {
          const res = await phoneOrderSearchLastOrder(params)
          if (res.data) {
            // await this.getGoodsTypeDetails(res.data.gtId, false)
            // await this.addGoods(res.data)
            this.tableData.data = [res.data]
          }
        } catch (e) {
          console.log(e)
        }
      },
      // 获取余额
      async getDepositOrder() {
        try {
          const res = await phoneOrderDepositOrder({ csmCode: this.phoneData.csmCode })
          if (res.data) {
            this.cmsCodeData = res.data
          }
        } catch (e) {
          console.log(e)
        }
      },
      // 客户信息快速查询
      async getFastSearchInfo() {

      },
      // phoneOrderDepositOrder
      // 订气记录
      async get3orderHistory(value = 3) {
        try {
          const params = {
            csmId: this.temp.csmId,
            topCount: value
          }
          const res = await phoneOrderby3order(params)
          this.cmstop3 = res.data
          // console.log(res)
        } catch (e) {
          console.log(e)
        }
      },
      // 获取所属机构数据
      async getOrgTreeData() {
        // const res = await organizationQueryList({})
        const data = this.orgList.map(item => ({
          label: item.name,
          ...item
        }))
        this.orgTreeData = getTreeData(data)
      },
      selectOrgTreeChange(value) {
        // console.log(value, 'topOrg')
        if (value !== this.orgSNNo) {
          this.$message.warning('机构发生变化对应的区域价格可能发生变化,商品需重新选择')
          this.tableData.data = []
        }
        this.orgSNNo = value.orgSNNo
        // this.submitForm.orgSNNo = value.orgSNNo
        this.orgData = { ...value }
        this.orderForm.goodsId = null
        this.orderForm.gtId = null
      },
      // 储存当前机构对象
      saveOrgData() {
        this.orgData = this.orgList.find(l => l.orgSNNo === this.temp.orgSNNo)
      },
      // 级联选择
      async selectCascader(val) {
        // console.log(this.AddressData.address)
        // console.log(val, 'val')

        // this.cascaderKey++

        // if (!val) return
        // var pathLabels = this.$refs.cascader.getCheckedNodes()[0].pathLabels
        // // console.log(pathLabels)
        // this.addressCascader = {
        //   provinceName: pathLabels[0],
        //   provinceCode: val[0],
        //   cityName: pathLabels[1],
        //   cityCode: val[1],
        //   countryName: pathLabels[2],
        //   countryCode: val[2],
        //   streetName: pathLabels[3],
        //   streetCode: val[3]
        // }
        // console.log(this.addressCascader)
        // console.log(val)
      },
      // 获取当前级联选择的地址信息 用于表单提交
      getAddressCascaderInfo() {
        var pathLabels = this.$refs.cascader.getCheckedNodes()[0] ? this.$refs.cascader.getCheckedNodes()[0].pathLabels : []
        this.addressCascader = {
          provinceName: pathLabels[0] || '',
          provinceCode: this.AddressData.address[0] || '',
          cityName: pathLabels[1] || '',
          cityCode: this.AddressData.address[1] || '',
          countryName: pathLabels[2] || '',
          countryCode: this.AddressData.address[2] || '',
          streetName: pathLabels[3] || '',
          streetCode: this.AddressData.address[3] || ''
        }
        // console.log(this.addressCascader, ' this.addressCascader')
        return this.addressCascader
      },
      // 保存客户
      async saveUser() {
        const vm = this
        if (this.temp.phoneItems && !this.temp.csmId) {
          // alret('111')
        }
        try {
          if (!vm.temp.csmCode) {
            vm.$message.warning('未获取到客户编号')
            return
          }
          if (!vm.contactInfo.contact || !this.contactInfo.contact) {
            vm.$message.warning('请填写联系人姓名和电话')
            return
          }
          if (!this.orgData.orgSNNo) {
            vm.$message.warning('请选择组织机构')
            return
          }
          if (!this.AddressData.address || !this.AddressData.csmAddress) {
            vm.$message.warning('请完整填写客户地址')
            return
          }
          // var flag = await vm.$refs.dataForm.validate()
          // var flag2 = await vm.$refs.dataFormRight.validate()
          // // console.log(flag)
          // if (!flag || !flag2) {
          //   vm.$message.warning('请完成表单必填项')
          // }
          this.getAddressCascaderInfo()
          const params = {
            ...vm.addressCascader,
            comeFromEdit: 2,
            contact: vm.contactInfo.contact || '',
            csmCode: vm.temp.csmCode,
            csmFloor: this.AddressData.csmFloor ? this.AddressData.csmFloor : 1,
            csmName: this.contactInfo.contact,
            csmRgAddress: this.AddressData.csmAddress,
            csmRgPhone: this.contactInfo.csmPhone,
            csmStatus: 1, // 1
            csmType: this.temp.csmType,
            insureCode: this.temp.insureCode,
            insureEndDt: this.temp.insurance ? this.temp.insurance[1] : '',
            insureStartDt: this.temp.insurance ? this.temp.insurance[0] : '',
            orgId: this.orgData.orgId,
            orgName: this.orgData.orgName,
            orgSNNo: this.orgData.orgSNNo,
            remark: this.temp.remark,
            salesman: this.temp.saleManId,
            salesmanName: this.temp.saleMan,
            sfzh: this.temp.sfzh,
            zzbhFlag: 1
          }
          for (var value in params) {
            if (!params[value]) {
              delete params[value]
            }
          }
          console.log(params, '保存客户params')
          const res = await phoneOrderSaveUser(params)
          if (res.data) {
            this.temp = { ...this.temp, ...res.data }
          }
          if (res.success) {
            this.$message.success('保存成功')
          }
          // console.log(res)
        } catch (e) {
          console.log(e)
        }
        console.dir(this.$refs.cascader)
        // console.log(JSON.parse(JSON.stringify(this.cmstop3)))
        // console.log(JSON.parse(JSON.stringify(this.temp)))
      },
      // 选择关联电话联系人
      selectPhone(i, data) {
        // console.dir(this.$refs.selectPhone)
        for (var item of this.$refs.selectPhone.children) {
          item.style.backgroundColor = '#fff'
        }
        this.$refs.selectPhone.children[i].style.backgroundColor = 'rgba(1,153,159,0.4)'
        // console.log(data)
        // this.contactData.contact = data.contact
        // this.contactData.csmPhone = data.csmPhone
        // this.contactData = { ...this.contactData }
        this.contactInfo = { ...data } // 联系人详细信息
      },
      // 删除关联电话
      delPhone(data, index) {
        const vm = this
        const params = {
          csmPhoneId: data.csmPhoneId,
          csmPhone: data.csmPhone,
          csmId: data.csmId
        }

        vm.$confirm('是否删除此关联电话?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(async() => {
            const res = phoneOrderDelPhone(params)
            if (res.success) {
              this.phoneItems.splice(index, 1)
              this.$message.success('删除成功')
            }
          })
          .catch((e) => {
            this.$message.info('已取消删除操作')
          })
      },
      // 选择关联地址
      async selectAddress(i, data) {
        if (!i && !data) { // 不选择地址时的状态   如果客户地址很多  默认不选择
          for (var item of this.$refs.selectAddress.children) {
            item.style.backgroundColor = '#fff'
          }
          this.AddressData.address = []
          this.cascaderKey++
          return
        }

        for (item of this.$refs.selectAddress.children) {
          item.style.backgroundColor = '#fff'
        }

        this.$refs.selectAddress.children[i].style.backgroundColor = 'rgba(1,153,159,0.4)'
        this.AddressData = { ...data }

        this.tableData.data = []
        if (data.csmAddressId) {
          await this.searchLastOrder(data.csmAddressId)
          await this.searchCsmGasCheck(data.csmAddressId)
        }
        //  通知级联地址选择框回显
        var list = [data.provinceCode, data.cityCode, data.countryCode, data.streetCode]
        // this.$set(this.AddressData, 'address', [])
        // list.forEach(l => {
        //   this.AddressData.address.push(l)
        // })
        list = list.filter(l => l * 1 !== 0)
        this.AddressData.address = [...list]
        this.cascaderKey++
        // console.log(this.AddressData.address, '1111')
        this.queryGasCheckSet() // 安全隐患
        this.temp.csmId = data.csmId
        // this.$nextTick(() => {

        // })
      },
      // 删除关联地址
      delAddress(data, index) {
        const vm = this
        const params = {
          csmAddressId: data.csmAddressId,
          csmId: data.csmId
        }
        vm.$confirm('是否删除此关联地址?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(async() => {
            const res = await phoneOrderDelAddress(params)
            if (res.success) {
              this.addressItems.splice(index, 1)
              this.$message.success('删除成功')
            }
          })
          .catch((e) => {
            this.$message.info('已取消删除操作')
          })
      },
      // 折叠效果
      fold(refItem) {
        const classname = event.target.className
        const flag = classname.includes('bottom')
        if (flag) {
          event.target.className = 'el-icon-caret-top'
        } else {
          event.target.className = 'el-icon-caret-bottom'
        }
        var height = this.$refs[refItem].style.height
        // console.log(height)
        var changeNum = '115px'
        if (refItem === 'shortcut') {
          changeNum = '380px'
        }
        // console.log(changeNum)
        if (height === '0px') {
          this.$refs[refItem].style.height = changeNum
        } else {
          this.$refs[refItem].style.height = '0'
        }
      },
      // 查询客户是否存在未审核的安检单
      async searchCsmGasCheck(csmAddressId) {
        try {
          const res = await phoneOrderCsmGasCheck({ csmAddressId })
          console.log(res)
          this.anjianInfo = res.data
        } catch (e) {
          console.log(e)
        }
      },
      //
      // 快速查询
      async  fastSearch() {
        // shortcutParams.cmsAddress
        //  <el-option label="客户电话" :value="1" />
        //       <el-option label="客户名称" :value="2" />
        //       <el-option label="客户编码" :value="3" />
        //       <el-option label="身份证" :value="4" />
        //       <el-option label="使用证" :value="5" />
        //       <el-option label="充值卡" :value="6" /> csmRgAddress
        try {
          var paramInfo = {}
          var paramName
          if (this.shortcutParams.select === 1) {
            paramName = 'csmRgPhone'
          } else if (this.shortcutParams.select === 2) {
            paramName = 'csmName'
          } else if (this.shortcutParams.select === 3) {
            paramName = 'csmCode'
          } else if (this.shortcutParams.select === 4) {
            paramInfo.sfzh = this.shortcutParams.csmPhone
            // paramName = 'csmCode'
          } else if (this.shortcutParams.select === 5) {
            paramInfo.cardType = 1
            paramInfo['cardNo'] = this.shortcutParams.csmPhone
          } else if (this.shortcutParams.select === 6) {
            paramInfo.cardType = 2
            paramInfo['cardNo'] = this.shortcutParams.csmPhone
          }
          paramInfo[paramName] = this.shortcutParams.csmPhone
          if (this.shortcutParams.cmsAddress) {
            paramInfo = {
              csmRgAddress: this.shortcutParams.cmsAddress
            }
          }
          // { csmRgPhone: this.phoneData.csmRgPhone }
          const res = await phoneOrderFastSearch(paramInfo)
          if (res.data) {
            // this.cmsCodeData = res.data
            this.qkparams = res.data
          }
        } catch (e) {
          console.log(e)
        }
        // console.log(this.shortcutParams)
        // this.qkparams = qkparams.data
        // console.log(JSON.parse(JSON.stringify(this.qkparams)))
      },
      // 快捷查询的单选事件
      changeRadio(val) {
        // console.log(val)
        // console.log(this.qkparams[val]['csmId'])
        for (var item of this.$refs.checkRadio.children) {
          item.style.backgroundColor = '#fff'
        }
        this.$refs.checkRadio.children[val].style.backgroundColor = 'rgba(1,153,159,0.2)'
        this.searchForPhone(false, this.qkparams[val]['csmId'])
      },
      // 查询优惠价格
      // phoneOrderSearchspecialPrice
      async specialPrice(param) {
        try {
          const res = await phoneOrderSearchspecialPrice({ gtSNNo: param })
          return res
        } catch (e) {
          console.log(e)
        }
      },
      // 获取主营商品价格
      async getGoodsPrices() {
        try {
          const res = await phoneOrderGoodsPrices()
          this.mainGoodsPrices = res.data
        } catch (e) {
          console.log(e)
        }
      },
      // 查询区域价格
      async GetAreaprice(params) {
        try {
          const res = await phoneOrderAreaprice(params)
          this.AreapriceList = res.data
        } catch (e) {
          console.log(e)
        }
      },
      // 查询商品服务费
      async GetServePrice(params) {
        try {
          const res = await phoneOrderServePrice(params)
          this.ServePriceList = res.data
        } catch (e) {
          console.log(e)
        }
      },
      // 查询商品楼层费
      async GetFloorfee(params) {
        try {
          const res = await phoneOrderFloorfee(params)
          this.FloorfeeList = res.data
        } catch (e) {
          console.log(e)
        }
      },
      calCost(rowdata) {
        if (!rowdata) { return }
        var toFloat = function(str) {
          if ((/^(-?\d+)(\.\d+)?$/).test(str)) {
            return parseFloat(str)
          }
          return 0
        }
        var toInt = function(str) {
          if ((/^-?\d+$/).test(str)) {
            return parseInt(str)
          }
          return 0
        }
        var toDecimal = function(str, p) {
          if (/^(-?\d+)(\.\d+)?$/.test(str)) {
            return parseFloat(str).toFixed(p || 2) * 1
          }
          return 0
        }

        var price = toFloat(rowdata.diff ? rowdata.definePrice : rowdata.gprince)
        var gprefPrice = toFloat(rowdata.gprefPrice)
        if (gprefPrice > price) {
          // $dlh.toast.info("优惠价格不能比市价大");
          gprefPrice = price
        }
        var gcount = toInt(rowdata.gcount)
        var fee1 = 0; var fee2 = 0; var tip = 0
        if (!this.isPickUp) {
          if (rowdata.userTip) {
            tip = rowdata.userTip
          } else {
            tip = toFloat(rowdata.tip1) * gcount
          }
          if (rowdata.userFee1) {
            fee1 = rowdata.userFee1
          } else {
            fee1 = toFloat(rowdata.yf) * gcount
          }
          if (rowdata.userFee2) {
            fee2 = rowdata.userFee2
          } else {
            if (rowdata.isSpeicalPriceFloor) {
              var floors = this.csmInfo ? (this.csmInfo.csmFloor || 1) : 1
              if (floors > 1) {
                if (this.maxFloor > 0) {
                  floors = Math.min(floors, this.maxFloor)
                }
                fee2 = ((floors - 1) * toFloat(rowdata.fee21))
                fee2 += rowdata.baseFloorFee
                fee2 *= gcount
              }
            } else {
              fee2 = rowdata.fee21 * gcount
            }
          }
        }
        rowdata.fee1 = toDecimal(fee1, 2).toFixed(2)
        rowdata.fee2 = toDecimal(fee2, 2).toFixed(2)
        rowdata.tip = toDecimal(tip, 2).toFixed(2)
        rowdata.gprefPrice = gprefPrice
        // rowdata.treceivable = Number((price - gprefPrice) * gcount + rowdata.tip * 1 + rowdata.fee1 * 1 + rowdata.fee2 * 1).toFixed(2)
        // rowdata.requiredScore = toInt(rowdata.priceScore) * toInt(rowdata.gcount)
        return rowdata
      },

      // 添加商品
      async addGoods(params) {
        const vm = this
        // console.log(vm.goodsTypesDetailList)
        // console.log(this.orderForm)
        var goodsInfo, gtInfo
        if (params.goodsId) {
          goodsInfo = vm.goodsTypesDetailList.find(l => l.goodsId === params.goodsId)
          gtInfo = vm.goodsTreeData.find(l => l.gtId === params.gtId)
        } else {
          goodsInfo = vm.goodsTypesDetailList.find(l => l.goodsId === vm.orderForm.goodsId)
          gtInfo = vm.goodsTreeData.find(l => l.gtId === vm.orderForm.gtId)
          if (!this.orderForm.goodsId || !this.orderForm.gtId) {
            vm.$message.warning('请先选择商品')
            return
          }
        }
        // console.log(vm.goodsTreeData, 'goodsTreeData')
        // console.log(goodsInfo, 'goodsInfo')
        for (var i in this.tableData.data) {
          var item = this.tableData.data[i]
          if (item.goodsId === goodsInfo.goodsId) {
            // if (this.orderFlag == 2 && $dlh.context.corpsetting.exchangeBuyMax) {
            //   if (item.gcount >= $dlh.context.corpsetting.exchangeBuyMax) {
            //     return
            //   }
            // }
            if (item.gcount >= 999999) {
              return
            }
            vm.$message.info('此商品已存在 数量累加  1 ')
            item.gcount++
            delete item.userFee1
            delete item.userFee2
            this.calCost(item)
            // grid.datagrid('refreshRow', i)
            // this.calcGridTotal(grid)
            return
          }
        }

        const specialPriceList = await vm.specialPrice(goodsInfo.gtSNNo)
        var gprefPrice = 0
        if (specialPriceList.data.length > 0) {
          var specialPriceData = specialPriceList.data.find(l => {
            return vm.temp.csmType === l.customerType * 1 && vm.AddressData.orgSNNo * 1 === l.orgSNNo * 1
          })
          if (specialPriceData) gprefPrice = specialPriceData.price
        }
        var mainPriceData = vm.mainGoodsPrices.find(l => l.goodsId === goodsInfo.goodsId)
        var mainPrice = 0
        if (mainPriceData) mainPrice = mainPriceData[`price${vm.temp.csmType}`] ? mainPriceData[`price${vm.temp.csmType}`] : mainPriceData[`price0`]
        // console.log(mainPriceData, 'mainPriceData')
        // var baseprice0 = mainPriceData['price0'] || 0
        // var baseprice = mainPriceData[('price' + vm.temp.csmType)] || baseprice0
        // console.log(mainPriceData)

        var rowdata = { id: new Date().getTime(),
                        goodsName: goodsInfo.goodsName,
                        goodsId: goodsInfo.goodsId,
                        gprince: mainPrice,
                        tag: parseInt(mainPrice * 100),
                        definePrice: 0,
                        diff: 0,
                        gcount: 1, // 数量
                        gprefPrice: gprefPrice, // 优惠价格
                        tip: goodsInfo.tip || 0,
                        fee1: goodsInfo.deliveryFun || 0,
                        fee2: goodsInfo.floorFun || 0,
                        baseFloorFee: goodsInfo.baseFloorFee || 0,
                        treceivable: 0,
                        gtId: gtInfo.gtId,
                        gtFlag: gtInfo.gtFlag,
                        priceScore: goodsInfo.requiredScore || 0,
                        requiredScore: goodsInfo.requiredScore || 0,
                        pricingMode: goodsInfo.pricingMode || 1,
                        specCode: goodsInfo.specCode || '',
                        specName: goodsInfo.specName || '',
                        storeCount: goodsInfo.storeCount || 0,
                        isSpeicalPriceFloor: goodsInfo.isSpeicalPriceFloor
        }
        if (gtInfo.gtFlag < 3 && !goodsInfo.diff) { // && this.isBasePrice == false
          // TODO 寻址 区域特价
          var orgPNNo = vm.orgList.find(l => l.orgSNNo === vm.AddressData.orgSNNo).orgPNNo
          // console.log(orgPNNo, 'orgPNNo')
          var areaItem = vm.AreapriceList.find(l => l.goodsId === goodsInfo.goodsId && l.orgPNNo === orgPNNo)
          // console.log(areaItem, 'areaItem')
          if (areaItem) {
            if (vm.name !== 'phoneOrder') {
              rowdata.gprince = areaItem['price0']
            } else {
              rowdata.gprince = areaItem['price' + vm.AddressData.csmType] || areaItem['price0']
            }
          }
          // 服务费
          // console.log(vm.ServePriceList, 'vm.ServePriceList')
          // var serveItem = vm.ServePriceList.find(l => l.goodsId === goodsInfo.goodsId && l.orgPNNo === orgPNNo)
          var serveItem = this.sosoServicePrice(vm.ServePriceList, goodsInfo.goodsId)
          // console.log(serveItem, 'serveItem')
          // console.log(vm)
          if (serveItem) {
            if (vm.name !== 'phoneOrder') { // this.isBasePrice
              var fee1 = serveItem['spFee0']
              if (fee1 & 0x01 > 0) {
                rowdata.fee1 = (fee1 >> 1) & 0.01
              }
              var fee2 = serveItem['lpFee0']
              if (fee2 & 0x01 > 0) {
                rowdata.fee2 = (fee2 >> 1) & 0.01
              }
              var tip = serveItem['tpFee0']
              if (tip & 0x01 > 0) {
                rowdata.tip = (tip >> 1) & 0.01
              }
            } else {
              var index = Math.log(vm.temp.csmType || 1) / Math.log(2)
              index++
              fee1 = serveItem['spFee' + index] || serveItem['spFee0']
              if (fee1 & 0x01 > 0) {
                rowdata.fee1 = (fee1 >> 1) * 0.01
              }
              fee2 = serveItem['lpFee' + index] || serveItem['lpFee0']
              if (fee2 & 0x01 > 0) {
                rowdata.fee2 = (fee2 >> 1) * 0.01
              }

              tip = serveItem['tpFee' + index] || serveItem['tpFee0']
              if (tip & 0x01 > 0) {
                rowdata.tip = (tip >> 1) * 0.01
              }
            }
            rowdata.fee1 = rowdata.fee1.toFixed(2)
            rowdata.fee2 = rowdata.fee2.toFixed(2)
            rowdata.tip = rowdata.tip.toFixed(2)
          }
        }
        // console.log(rowdata,'1111')
        // // 特价自定义上楼费不覆盖
        if (!goodsInfo.isSpeicalPriceFloor) {
          var floorDatas = vm.FloorfeeList
          // console.log(vm.FloorfeeList.filter(l => l.orgSNNo === this.orgData.orgSNNo), 'vm.FloorfeeList')
          if (floorDatas) {
            var floorFee = vm.sosoFloorFee(floorDatas, goodsInfo.goodsId, vm.temp.csmType)
            // console.log(floorFee, 'floorFee')
            rowdata.fee2 = floorFee
          } else {
            rowdata.fee2 = 0
          }
        }
        var toDecimal = function(str, p) {
          if (/^(-?\d+)(\.\d+)?$/.test(str)) {
            return parseFloat(str).toFixed(p || 2) * 1
          }
          return 0
        }
        rowdata.yf = rowdata.fee1 // 单个商品原始的配送费
        rowdata.fee21 = rowdata.fee2 // 单个商品原始的上楼费
        rowdata.tip1 = rowdata.tip // 单个商品原始的服务费
        if (goodsInfo.diff) {
          var definePrice = goodsInfo.definePrice || 0
          if (goodsInfo.diff === 1) {
            definePrice = Math.max(0, mainPrice - definePrice)
          }
          rowdata.definePrice = toDecimal(definePrice, 2)
          rowdata.diff = goodsInfo.diff
        }
        rowdata = vm.calCost(rowdata)
        // console.log(rowdata, 'rowdata')
        if (vm.orderForm.orderFlag === 2) {
          vm.tableDataScore.data.push(rowdata)
          return '商品兑换'
        }
        vm.tableData.data.push(rowdata)
        // console.log(this.tableData.data)
      },
      sosoFloorFee(datas, gdId, csmType) {
        const vm = this
        var orgInfo = this.orgData
        const floor = vm.AddressData.csmFloor ? vm.AddressData.csmFloor : 1
        const $ = {
          isEmptyObject: function(a) {
            var b
            for (b in a) { return !1 }
            return !0
          }
        }
        const isMatch = function(r, s) {
          return new RegExp(r).test(s)
        }
        if (!orgInfo) {
          orgInfo = { orgSNNo: '001000000000000000000' }
        }
        var orgSNNo = orgInfo.orgSNNo

        var goods = false
        for (var i in datas) {
          var item = datas[i]
          if (item.goodsId === gdId) {
            goods = true
            break
          }
        }

        if (goods) {
          var matchArr = []
          for (i in datas) {
            item = datas[i]
            if (item.goodsId === gdId && isMatch('^' + item.orgPNNo, orgSNNo)) {
              matchArr.push(item)
            }
          }

          var length = 0
          var result = []
          for (var j in matchArr) {
            item = matchArr[j]
            if (item.orgPNNo.length > length) {
              length = item.orgPNNo.length
              result.length = 0
              result.push(item)
            } else if (item.orgPNNo.length === length) {
              result.push(item)
            }
          }

          var match = {}
          matchArr = []
          for (var k in result) {
            item = result[k]
            if (item.floorStart <= floor && item.floorEnd >= floor && item[('floorFee' + csmType)] >= 0) {
              matchArr.push(item)
            }
          }
          match = this.matchFloor(matchArr, floor)

          var arr = []
          if ($.isEmptyObject(match)) {
            for (i = 0; i < result.length; i++) {
              item = result[i]
              if (!(item.floorStart <= floor && item.floorEnd >= floor) && item[('floorFee' + csmType)] >= 0) {
                arr.push(item)
              }
            }
            match = this.matchFloor(arr, floor)
          }

          if ($.isEmptyObject(match)) {
            for (k in result) {
              item = result[k]
              if (item.floorStart <= floor && item.floorEnd >= floor && item['baseFee'] >= 0) {
                matchArr.push(item)
              }
            }
            match = this.matchFloor(matchArr, floor)
          }
          // console.log('$.isEmptyObject(match)', $.isEmptyObject(match))
          if ($.isEmptyObject(match)) {
            for (i = 0; i < result.length; i++) {
              item = result[i]
              if (!(item.floorStart <= floor && item.floorEnd >= floor) && item['baseFee'] >= 0) {
                arr.push(item)
              }
            }
            match = this.matchFloor(arr, floor)
          }
          // console.log(match, 'arr')
          if (match.mode === 1) {
            return Number((match[('floorFee' + csmType)] || (match.baseFee ? match.baseFee : 0)) + (match.floor - match.floorStart) * match.modeAmount).toFixed(2)
          } else if (match.mode === 2) {
            result = Number((match[('floorFee' + csmType)] || (match.baseFee ? match.baseFee : 0)) - (match.floor - match.floorStart) * match.modeAmount).toFixed(2)
            return result < 0 ? 0 : result
          } else {
            return Number(match[('floorFee' + csmType)] || (match.baseFee ? match.baseFee : 0)).toFixed(2)
          }
        }
        return undefined
      },
      sosoServicePrice(datas, gdId) {
        // TODO
        var orgInfo = this.orgData
        if (!orgInfo) {
          orgInfo = { orgSNNo: '001000000000000000000' }
        }
        var orgSNNo = orgInfo.orgSNNo

        var flag = false
        for (var i in datas) {
          var item = datas[i]
          if (item.goodsId !== gdId) {
            if (flag) {
              break
            }
            continue
          } else if (flag === false) {
            flag = true
          }
          if (new RegExp('^' + item.orgPNNo).test(orgSNNo)) {
            return item
          }
        }
        return undefined
      },
      matchFloor(arr, floor) {
        var match = {}
        for (var k in arr) {
          var item = arr[k]
          if (item.floorStart <= floor && floor <= item.floorEnd) {
            match = item
            match.floor = floor
            return match
          }
        }

        var max = 0
        for (k in arr) {
          item = arr[k]
          if (item.floorEnd < floor) {
            max++
          }
          if (max === arr.length) {
            match = arr[arr.length - 1]
            match.floor = match.floorEnd
            return match
          }
        }
        var min = 0
        for (k in arr) {
          item = arr[k]
          if (item.floorStart > floor) {
            min++
          }
          if (min === arr.length) {
            match = arr[0]
            match.floor = match.floorStart
            return match
          }
        }

        for (k in arr) {
          item = arr[k]
          if (item.floorStart > floor) {
            match = arr[k - 1]
            match.floor = match.floorEnd
            return match
          }
        }
        return match
      },
      // 查询处理人
      async search_OrgidList() {
        const params = {
          orgId: this.orgId,
          corpparm1: 1
        }
        const res = await searchOrgidList(params)
        this.userData = res.data
      },
      // searchOrgidList
      // 销售人员
      openInsure() {
        this.$refs.insure.open()
      },
      // 接受子组件insure 的值
      changeSaleMan(val) {
        // console.log(val)
        this.$set(this.temp, 'saleMan', val.name)
        this.$set(this.temp, 'saleManId', val.id)
      },
      // 合计
      getSummaries(param) {
        const { columns, data } = param
        // console.log(data)
        const sums = []
        columns.forEach((column, index) => {
          if (index === 0) {
            sums[index] = '合计'
            return
          }
          const values = data.map(item => Number(item[column.property]))
          if (!values.every(value => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
            if (this.orderForm.orderFlag === 1) {
              sums[index] = sums[index].toFixed(2)
            }
          } else {
            // console.log(sums[index])
            sums[index] = ''
          }
        })

        return sums
      },
      // 应收
      goodsPrice(row) {
        const value = (row.gprince * 1 - row.gprefPrice * 1) * row.gcount * 1 + row.fee1 * 1 + row.fee2 * 1 + row.tip * 1
        row.receivable = value.toFixed(2)
        return value.toFixed(2)
      },
      // 应收
      goodsScores(row) {
        const value = (row.priceScore * 1) * (row.gcount * 1)
        row.requiredScore = value.toFixed(2)
        return value
      },
      // 选择数量
      changeNum(row, index) {
        // console.log(row)
        // console.log(index)
        const value = event.target.value
        row.gcount = value
      },
      // 删除商品
      delGoods(index) {
        const vm = this
        vm.$confirm('是否将该商品移除列表?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(() => {
            if (this.orderForm.orderFlag === 2) {
              this.tableDataScore.data.splice(index, 1)
            }
            this.tableData.data.splice(index, 1)
            // this.$message.success('删除成功')
          })
          .catch((e) => {
            // this.$message.info('已取消删除操作')
          })
      },

      // 获取商品分类树
      async getGoodsTreeData() {
        const res = await goodsTypeQueryList({})
        // console.log(res)
        const data = res.data.map(item => ({
          label: item.gtName,
          ...item
        }))
        this.goodsTreeData = getTreeData(data)
        this.orderForm.orderFlag = 1
      },
      // 选择商品分类
      async selectTreeChange(value) {
        if (!this.AddressData.orgSNNo) {
          this.$message.warning('请选择客户所属机构')
          return ''
        }
        this.getGoodsTypeDetails(value.gtId)
      },
      // 获取商品分类详情
      async getGoodsTypeDetails(val, bool = true) {
        try {
          if (this.orderForm.orderFlag === 1) {
            var res = await goodsTypeDetail({ gtId: val })
            if (!res.data.rows) return
            this.goodsTypesDetailList = res.data.rows
          } else if (this.orderForm.orderFlag === 2) {
            res = await phoneOrdersearchScore({ gtId: val, orgSNNo: this.AddressData.orgSNNo, csmType: this.temp.csmType })
            if (!res.data) return
            this.goodsTypesDetailList = res.data
          }

          this.orderForm.goodsId = null
          if (bool && this.goodsTypesDetailList.length > 0) this.orderForm.goodsId = this.goodsTypesDetailList[0].goodsId
          // console.log(res)
        } catch (error) {
          console.log(error)
        }
      },
      handleEdit(row, $index) {
        this.$set(row, '_edit', true)
      },
      handleSave(row, $index) {
        // const reg = /^(-?\d+)(\.\d+)?$/
        // if (!reg.test(row.discount)) {
        //   this.$message.warning('权益数值只能为数值')
        //   return
        // }
        // if (!reg.test(row.disLimit)) {
        //   this.$message.warning('优惠上限只能为数值')
        //   return
        // }
        this.$set(row, '_edit', false)
        this.$set(this.tableData.data, $index, JSON.parse(JSON.stringify(row)))
      },
      // 编辑订单
      changeInput(row, column, value) {
        row[column.property] = value
        // console.log(value)
        // var reg=/(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0)$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/
        // console.log(reg.test(value))
        // const reg = /^(-?\d+)(\.\d+)?$/
        // console.log(value)
        // if (reg.test(value)) {
        //   row[column.property] = value
        //   // this.tableData.data = [...this.tableData.data]
        // } else {
        //   row[column.property] = value

        //   // row[column.property] = ''
        // }
      },
      // 编辑校验
      blurInput(row, column, value) {
        var reg = /(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0)$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/
        // console.log(reg.test(row[column.property]))
        var flag = reg.test(row[column.property])
        if (!flag && row[column.property]) {
          this.$message.warning(`${column.label}只能输入数字或小数，请重新输入`)
          row[column.property] = ''
        }
      },
      async SubmitSelectOrgTreeChange(val) {
        // console.log(val)
        this.orgId = val.orgId
        await this.search_OrgidList()
      },
      async sumitOrderFn(params, tables, keep) {
        const vm = this
        if (tables && tables.length > 0) {
          const res = await phoneOrderSubmit({
            billJson: params,
            detailJson: tables,
            gasCheck: vm.submitForm.checkList.gasCheck ? 1 : 0,
            callCode: ''
          })
          if (res.success) {
            vm.$message.success('订单提交成功')
            vm.tableData.data = []
            vm.tableDataScore.data = []
            if (!keep) vm.closeTag()
          }
        } else {
          vm.$message.warning('请添加商品')
        }
      },
      // 提交并继续
      submitOrderKeep(keep = true) {
        const vm = this
        if (!this.temp.csmId) {
          vm.$message.warning('请先保存客户')
          return
        }
        // console.log({ ...this.temp })
        // console.log(this.submitForm)
        // 预约时间
        var intSpare6 = 0
        var array = [this.submitForm.appointment, this.submitForm.time]
        var flag1 = array.every(l => Boolean(l) === true)
        var flag2 = array.every(l => Boolean(l) === false)
        if (!(flag1 || flag2)) {
          vm.$message.warning('如选择了预约时间,请完整填写预约时间')
          intSpare6 = 1
          return
        }
        var day = this.submitForm.appointment * 1 + 1
        if (day && this.submitForm.time) { // 判断填写了预约时间
          var time1 = this.submitForm.time[0].getHours() * 60 * 60 * 1000 + this.submitForm.time[0].getMinutes() * 60 * 1000 + this.submitForm.time[0].getSeconds() * 1000
          var time2 = this.submitForm.time[1].getHours() * 60 * 60 * 1000 + this.submitForm.time[1].getMinutes() * 60 * 1000 + this.submitForm.time[1].getSeconds() * 1000
          var starTime = new Date(day + time1)
          var endTime = new Date(day + time2)
          if (new Date() * 1 > starTime * 1) {
            vm.$message.warning('预约时间错误,请重新选择')
            return
          }
        }

        // 处理人
        if (!this.submitForm.ownerId) {
          // userData
          vm.$message.warning('请选择处理人')
          return
        }
        var ownerData = vm.userData.find(l => l.userId === vm.submitForm.ownerId)
        // console.log(ownerData, 'this.orgData')
        // console.log(ownerData)
        this.getAddressCascaderInfo()
        const params = {
          //         AddressData: {}, // 联系人地址信息
          // contactInfo: {}, // 联系人详细信息
          'fromPlat': 1,
          'csmId': this.temp.csmId || '',
          'csmCode': this.temp.csmCode || '',
          'csmName': this.temp.csmName || '',
          'csmPhone': this.temp.csmRgPhone || '',
          'contactPhone': this.contactInfo.csmPhone || '',
          'isPickUp': this.temp.isPickUp || 0,
          'contact': this.contactInfo.contact || '',
          'csmAddressId': this.AddressData.csmAddressId || '',
          'csmAddress': `${this.addressCascader.provinceName}${this.addressCascader.countryName}${this.addressCascader.cityName}${this.addressCascader.streetName}${this.AddressData.csmAddress}（楼层${this.temp.csmFloor ? this.temp.csmFloor : 1}）`,
          'intSpare5': this.AddressData.csmFloor || 1, // 楼层
          'csmType': this.temp.csmType || '',
          'strSpare2': this.temp.sfzh || '',
          'insureEndDt': this.temp.insurance ? this.temp.insurance[1] : '',
          'saleMan': this.temp.saleMan || '',
          'dateTimeSpare2': this.AddressData.lastSCheckDt ? this.parseDate(this.temp.lastSCheckDt) : '',
          'lon': this.AddressData.longitude,
          'lat': this.AddressData.latitude,
          'intSpare6': intSpare6,
          'appointmentDt': starTime,
          'dateTimeSpare1': endTime || '',
          'orgId': this.orgData.orgId || '',
          'orgSNNo': this.orgData.orgSNNo || '',
          'orgName': this.orgData.orgName || '',
          'ownerId': ownerData.userId || '',
          'ownerCode': ownerData.userCode || '',
          'ownerName': ownerData.userName || '',
          'isUrgent': this.submitForm.checkList.isUrgent ? 1 : 0,
          'isInvoice': this.submitForm.checkList.isInvoice ? 1 : 0,
          'paymentMethod': this.submitForm.checkList.settlementType_monthly ? 16 : 0,
          'reStatus': this.submitForm.checkList.isRe ? 2 : 1,
          'intSpare1': this.submitForm.checkList.isZb ? 1 : 0,
          'remark': this.submitForm.remark,
          'orderFlag': vm.orderForm.orderFlag
        }
        for (var value in params) {
          if (!params[value]) {
            delete params[value]
          }
        }
        // console.log(params, '订单params')
        if (this.TabsActiveName !== 'dingGou') return
        // this.$message.info('提交并继续')
        this.sumitOrderFn(params, this.orderForm.orderFlag === 1 ? this.tableData.data : this.tableDataScore.data, keep)
      },
      // 老平台的日期格式化
      parseDate(str) {
        if (/^([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}).([0-9]{1,3})\+(0800)$/.test(str)) {
          return new Date(str)
        }
        str = String(str).replace(/-/g, '/').replace('Z', '').replace('T', ' ')
        if (str.indexOf('.') > 0) {
          var dd = str.split('.')
          var d = new Date(dd[0])
          d.setMilliseconds(dd[1])
          return d
        }
        return new Date(str)
      },
      // 提交订单
      submitOrder() {
        if (this.TabsActiveName !== 'dingGou') return
        // this.$message.info('提交订单')

        this.submitOrderKeep(false)
      },
      // 超期未安检有关（老平台）
      dateDiff(interval, dt1, dt2) {
        if (!dt1) {
          dt1 = new Date()
        }
        if (!dt2) {
          dt2 = new Date()
        }
        if (arguments.length < 2) {
          return 0
        }
        var objInterval = {
          'D': 1000 * 60 * 60 * 24,
          'H': 1000 * 60 * 60,
          'M': 1000 * 60,
          'S': 1000,
          'T': 1
        }
        interval = interval.toUpperCase()
        return Math.round((dt2.getTime() - dt1.getTime()) / objInterval[interval])
      },
      queryGasCheckSet() {
        var lastSCheckDt = this.AddressData.LastSCheckDt || this.AddressData.lastSCheckDt || ''
        if (!lastSCheckDt) {
          this.checkDtStr = ''
          return
        }
        this.checkDtStr = parseTime(lastSCheckDt, '{y}-{m}-{d}') + ' '
        // 是否超期未安检
        var overCheck = false
        var lastSCheckDt2
        if (lastSCheckDt) {
          lastSCheckDt2 = this.parseDate(lastSCheckDt)
        } else {
          lastSCheckDt2 = this.parseDate('1970-01-01')
        }
        switch (this.AddressData.limitDays) {
        case -365:
          overCheck = (new Date().getFullYear() - lastSCheckDt2.getFullYear()) >= 1
          break
        case -90:
          if (new Date().getFullYear() - lastSCheckDt2.getFullYear() >= 1) {
            overCheck = true
          } else {
            overCheck = (new Date().getMonth() - lastSCheckDt2.getMonth()) >= 3
          }
          break
        case -30:
          if (new Date().getFullYear() - lastSCheckDt2.getFullYear() >= 1) {
            overCheck = true
          } else {
            overCheck = (new Date().getMonth() - lastSCheckDt2.getMonth()) >= 1
          }
          break
        default:
          overCheck = this.dateDiff('D', lastSCheckDt2, new Date()) > this.AddressData.limitDays
          break
        }
        if (overCheck) {
          // 开关：超期未安检提醒
          if ((this.AddressData.gasCheckSetOption >> 1 & 0x01) > 0) {
            this.checkDtStr += '<span style="color: red;font-weight: bold;">&ensp;(超期未安检)</span>'
          }
        }
        // _this.plat == 1
        if (this.temp) {
          if (!overCheck) {
            // 距离下次安检剩{0}天
            var remainDays = 0
            switch (this.AddressData.limitDays) {
            case -365:
              // 第二年的第一天和今天的差值
              var d = new Date(lastSCheckDt2.getFullYear() + 1, 0, 1)
              remainDays = this.dateDiff('D', d, new Date())
              break
            case -90:
              // 下一季度的第一天和今天的差值
              var currentSeason = Math.ceil((lastSCheckDt2.getMonth() + 1) / 3)
              d = new Date(lastSCheckDt2.getFullYear(), lastSCheckDt2.getMonth(), 1)
              d.addMonth(currentSeason * 3 - lastSCheckDt2.getMonth())
              remainDays = this.dateDiff('D', d, new Date())
              break
            case -30:
              // 下个月的第一天和今天的差值
              d = new Date(lastSCheckDt2.getFullYear(), lastSCheckDt2.getMonth() + 1, 1)
              remainDays = this.dateDiff('D', d, new Date())
              break
            default:
              // 两个日期之间的差值
              d = new Date(lastSCheckDt2)
              d.addDay(this.AddressData.limitDays)
              remainDays = this.dateDiff('D', d, new Date())
              break
            }
            this.checkDtStr += `距下次安检剩余<span style="color:red;">${Math.abs(remainDays) || 0}</span>天`
          }
          // 安检隐患
          // if (this.AddressData.lastCheckWarnLevel) {
          //   this.checkDtStr += String.format(' <a href="#" style="color:red;text-decoration: underline;" onclick="javascript:{0}.current.showWarnLevelWin({1});return false;">{2}</a>'
          //                                   , this.AddressData.lastCheckId, _this.warnLevelObj[this.AddressData.lastCheckWarnLevel])
          // }
        }
      },
      // 订单流转信息
      openFlow(row) {
        this.$refs.flow.open(row.orderCode)
      },
      // 除订单外流转信息
      openOhtersFlow(row) {
        this.$refs.OhtersFlow.open(row)
      },
      // 催单
      openUrge(temp) {
        this.$refs.urge.open(temp)
      },
      // 退单
      async openBackOrder(row) {
        // console.log(row)
        // await this.$refs.backOrder.open(row)
        const res = await queryOrderbillReturnParam({
          orderCode: row.orderCode,
          ownerId: row.ownerId
        })
        const showCheck = JSON.parse(res.data.showCheck)
        if (showCheck) await this.$refs.backOrderApply.open(res.data)
        else await this.$refs.backOrder.open(res.data)
        this.$refs.lbTable.fetch({ currentPage: 1 })
      },
      // tabs切换
      handleClick(tab) {
        var name = tab.name
        if (name === 'dingGou') {
          return
        }
        this.$nextTick(() => {
          this.$refs[name].getData(this.temp.csmId)
        })
      },
      //  报修提交
      async  submitOrderBaoXiu() {
        // console.log('报修')
        const vm = this
        if (!this.temp.csmId) {
          vm.$message.warning('请先保存客户')
          return
        }
        if (!this.$refs.baoXiu.submit.remark) {
          vm.$message.warning('请填写报修内容')
          return
        }
        // console.log({ ...this.temp })
        // console.log(this.submitForm)
        // 预约时间
        var array = [this.submitForm.appointment, this.submitForm.time]
        var flag1 = array.every(l => Boolean(l) === true)
        var flag2 = array.every(l => Boolean(l) === false)
        if (!(flag1 || flag2)) {
          vm.$message.warning('如选择了预约时间,请完整填写预约时间')
          return
        }
        var day = this.submitForm.appointment * 1 + 1
        if (day && this.submitForm.time) { // 判断填写了预约时间
          var time1 = this.submitForm.time[0].getHours() * 60 * 60 * 1000 + this.submitForm.time[0].getMinutes() * 60 * 1000 + this.submitForm.time[0].getSeconds() * 1000
          var time2 = this.submitForm.time[1].getHours() * 60 * 60 * 1000 + this.submitForm.time[1].getMinutes() * 60 * 1000 + this.submitForm.time[1].getSeconds() * 1000
          var starTime = new Date(day + time1)
          var endTime = new Date(day + time2)
          if (new Date() * 1 > starTime * 1) {
            vm.$message.warning('预约时间错误,请重新选择')
            return
          }
        }

        // 处理人
        if (!this.submitForm.ownerId) {
          // userData
          vm.$message.warning('请选择处理人')
          return
        }
        var ownerData = vm.userData.find(l => l.userId === vm.submitForm.ownerId)
        // console.log(ownerData, 'this.orgData')
        // console.log(ownerData)
        this.getAddressCascaderInfo()
        // console.log({ ...this.temp }, 'temp')
        // console.log({ ...this.AddressData }, 'AddressData')
        // console.log({ ...ownerData }, 'ownerData')
        // console.log({...this.submitForm},'submitForm')
        const params = {
          appointmentEndTime: starTime || '',
          appointmentStartTime: endTime || '',
          callPhone: this.serach_phone,
          contact: this.contactInfo.contact || '',
          contactAddress: `${this.addressCascader.provinceName}${this.addressCascader.countryName}${this.addressCascader.cityName}${this.addressCascader.streetName}${this.AddressData.csmAddress}`,
          contactAddressId: this.AddressData.csmAddressId,
          contactPhone: this.contactInfo.csmPhone || '',
          csmAddress: `${this.addressCascader.provinceName}${this.addressCascader.countryName}${this.addressCascader.cityName}${this.addressCascader.streetName}${this.AddressData.csmAddress}`,
          csmCode: this.temp.csmCode || '',
          csmId: this.temp.csmId,
          csmName: this.temp.csmName,
          csmOrgId: this.AddressData.orgId,
          csmOrgName: this.AddressData.orgName,
          csmOrgSNNo: this.AddressData.orgSNNo,
          dueTime: new Date(),
          orgId: this.orgList.find(l => l.orgSNNo === this.submitForm.orgSNNo).orgId,
          orgName: this.orgList.find(l => l.orgSNNo === this.submitForm.orgSNNo).orgName,
          orgSNNo: this.submitForm.orgSNNo,
          remark: this.$refs.baoXiu.sumitRemark,
          repairContent: this.$refs.baoXiu.submit.checkList.join(',') + `+${this.$refs.baoXiu.submit.remark}`,
          userCode: ownerData.userCode,
          userId: ownerData.userId,
          userName: ownerData.userName
        }
        console.log(params, '报修提交')
        for (var value in params) {
          if (!params[value]) {
            delete params[value]
          }
        }
        try {
          const res = await phoneOrdersumitRepair({
            billJson: params,
            callCode: ''
          })
          if (res.success) {
            vm.closeTag()
            vm.$message.success('提交报修成功')
          }
        } catch (e) {
          console.log(e)
        }
      },
      // 退瓶提交
      async submitOrderTuiPing() {
        // console.log('退瓶')
        const vm = this
        if (!this.temp.csmId) {
          vm.$message.warning('请先保存客户')
          return
        }
        if (!this.$refs.tuiPing.submit.remark) {
          vm.$message.warning('请填写退瓶内容')
          return
        }
        // console.log({ ...this.temp })
        // console.log(this.submitForm)
        // 预约时间
        var array = [this.submitForm.appointment, this.submitForm.time]
        var flag1 = array.every(l => Boolean(l) === true)
        var flag2 = array.every(l => Boolean(l) === false)
        if (!(flag1 || flag2)) {
          vm.$message.warning('如选择了预约时间,请完整填写预约时间')
          return
        }
        var day = this.submitForm.appointment * 1 + 1
        if (day && this.submitForm.time) { // 判断填写了预约时间
          var time1 = this.submitForm.time[0].getHours() * 60 * 60 * 1000 + this.submitForm.time[0].getMinutes() * 60 * 1000 + this.submitForm.time[0].getSeconds() * 1000
          var time2 = this.submitForm.time[1].getHours() * 60 * 60 * 1000 + this.submitForm.time[1].getMinutes() * 60 * 1000 + this.submitForm.time[1].getSeconds() * 1000
          var starTime = new Date(day + time1)
          var endTime = new Date(day + time2)
          if (new Date() * 1 > starTime * 1) {
            vm.$message.warning('预约时间错误,请重新选择')
            return
          }
        }
        // 处理人
        if (!this.submitForm.ownerId) {
          // userData
          vm.$message.warning('请选择处理人')
          return
        }
        var ownerData = vm.userData.find(l => l.userId === vm.submitForm.ownerId)
        this.getAddressCascaderInfo()
        const params = {
          appointmentEndTime: starTime || '',
          appointmentStartTime: endTime || '',
          callPhone: this.serach_phone,
          contact: this.contactInfo.contact || '',
          contactAddress: `${this.addressCascader.provinceName}${this.addressCascader.countryName}${this.addressCascader.cityName}${this.addressCascader.streetName}${this.AddressData.csmAddress}`,
          contactAddressId: this.AddressData.csmAddressId,
          contactPhone: this.contactInfo.csmPhone || '',
          csmAddress: `${this.addressCascader.provinceName}${this.addressCascader.countryName}${this.addressCascader.cityName}${this.addressCascader.streetName}${this.AddressData.csmAddress}`,
          csmCode: this.temp.csmCode || '',
          csmId: this.temp.csmId,
          csmName: this.temp.csmName,
          orgId: this.orgList.find(l => l.orgSNNo === this.submitForm.orgSNNo).orgId,
          orgName: this.orgList.find(l => l.orgSNNo === this.submitForm.orgSNNo).orgName,
          orgSNNo: this.submitForm.orgSNNo,
          dueTime: new Date(),
          remark: this.$refs.tuiPing.sumitRemark,
          description: this.$refs.tuiPing.submit.checkList.join(',') + `+${this.$refs.tuiPing.submit.remark}`,
          userCode: ownerData.userCode,
          userId: ownerData.userId,
          userName: ownerData.userName
        }
        console.log(params, '退瓶提交')
        for (var value in params) {
          if (!params[value]) {
            delete params[value]
          }
        }
        try {
          const res = await phoneOrdersumitGiveback({
            billJson: params,
            callCode: ''
          })
          if (res.success) {
            vm.$message.success('退瓶申请已提交')
            vm.closeTag()
          }
        } catch (e) {
          console.log(e)
        }
      },
      //  投诉和其他咨询的提交
      async submitOrderOthers(refName, chineseName) {
        const vm = this
        if (!this.temp.csmId) {
          vm.$message.warning('请先保存客户')
          return
        }
        if (!this.$refs[refName].submit.remark) {
          vm.$message.warning(`请填写${chineseName}内容`)
          return
        }
        // 处理人
        if (!this.submitForm.ownerId) {
          vm.$message.warning('请选择处理人')
          return
        }
        var ownerData = vm.userData.find(l => l.userId === vm.submitForm.ownerId)
        this.getAddressCascaderInfo()
        const params = {
          callPhone: this.serach_phone,
          contact: this.contactInfo.contact || '',
          contactAddress: `${this.addressCascader.provinceName}${this.addressCascader.countryName}${this.addressCascader.cityName}${this.addressCascader.streetName}${this.AddressData.csmAddress}`,
          contactAddressId: this.AddressData.csmAddressId,
          contactPhone: this.contactInfo.csmPhone || '',
          csmAddress: `${this.addressCascader.provinceName}${this.addressCascader.countryName}${this.addressCascader.cityName}${this.addressCascader.streetName}${this.AddressData.csmAddress}`,
          csmCode: this.temp.csmCode || '',
          csmId: this.temp.csmId,
          csmName: this.temp.csmName,
          csmOrgId: this.AddressData.orgId,
          csmOrgName: this.AddressData.orgName,
          csmOrgSNNo: this.AddressData.orgSNNo,
          orgId: this.orgList.find(l => l.orgSNNo === this.submitForm.orgSNNo).orgId,
          orgName: this.orgList.find(l => l.orgSNNo === this.submitForm.orgSNNo).orgName,
          orgSNNo: this.submitForm.orgSNNo,
          dueTime: new Date(),
          remark: this.$refs[refName].sumitRemark,
          userCode: ownerData.userCode,
          userId: ownerData.userId,
          userName: ownerData.userName,
          csmPhone: this.temp.csmRgPhone
        }
        if (refName === 'touSu') {
          params.complainContent = this.$refs[refName].submit.checkList.join(',') + `+${this.$refs[refName].submit.remark}`
        } else if (refName === 'qiTa') {
          params.description = this.$refs[refName].submit.checkList.join(',') + `+${this.$refs[refName].submit.remark}`
        }
        console.log(params, chineseName + '提交')
        for (var value in params) {
          if (!params[value]) {
            delete params[value]
          }
        }
        try {
          var data = { billJson: params, callCode: '' }
          if (refName === 'touSu') {
            var res = await phoneOrdersumitComplain(data)
          } else {
            res = await phoneOrdersumitOrderOther(data)
          }

          if (res.success) {
            vm.closeTag()
            vm.$message.success('已提交')
          }
        } catch (e) {
          console.log(e)
        }
      },
      // 关闭当前标签页  并跳转到首页
      closeTag() {
        this.$store.dispatch('tagsView/delTag', this.$route).then(({ visitedTags }) => {
          if (this.isActive(this.$route)) {
            this.toLastView(visitedTags, this.$route)
          }
        })
        this.$router.push({ name: '首页' })
      }
    }
  }
</script>

<style lang='scss' scoped>
.main {
  // position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #fff;
  box-sizing: border-box;
  flex-wrap: wrap;
  // .left {
  //   width: 65%;
  // }
  // .right {
  //   margin-left: 20px;
  //   flex: 1;
  // }
}
.main_one {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  .left {
    width: 65%;
  }
  .right {
    width: 33%;
    margin-left: 20px;
  }
}
.moneyinfo {
  width: 200%;
  height: 19px;
  margin: 0 0 5px 10px;
  margin-left: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 19px;
  color: #333;
  text-indent: 8px;
  span {
    margin-right: 8px;
    color: #606266;
  }
}
.form {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  & /deep/ .el-form-item {
    width: 33%;
    .el-form-item__content > .el-select {
      width: 100%;
    }
  }
  .block {
    width: 64%;
  }
}
.info-title {
  display: flex;
  align-items: center;
  margin-top: 10px;
  margin-bottom: 20px;
  .title-icon {
    display: inline-block;
    width: 4px;
    height: 18px;
    margin-right: 6px;
    background: $themeColor;
  }
  span {
    font-weight: 700;
    color: $themeColor;
  }
  .clearfix {
    font-size: 14px;
  }
}

.cardBox_phone {

  /deep/ .el-card__body {
    // padding:5px 10px;
    padding: 0;
  }
  /deep/ .el-card__header {
    height: 24px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: bold;
    // padding: 0;
    line-height: 24px;
    color: #373A3C;
    background: #e3e3e3;
    border: 1px solid #ddd;
    box-sizing: border-box;
  }
  .text {
    display: flex;
    // border: 1px solid #dddddd;
    // border-top: 0px solid #dddddd;
    justify-content: space-between;
    height: 27px;
    font-size: 14px;
    line-height: 27px;
    color: #373A3C;
    text-indent: 1em;
  }
}
.chit_card {
  width: 100%;
  margin-bottom: 10px;
  //   /deep/ .el-card__body {
  //   padding:5px 10px;
  // }
  .card_main {
    width: 100%;
    height: 115px;
    overflow: hidden;
    transition: all 0.3s;
  }
  .card_main_shortcut {
    width: 100%;
    height: 380px;
    overflow: hidden;
    transition: all 0.3s;
  }
  .midOrder {
    width: 100%;
    margin-left: 55px;
    font-family: Microsoft YaHei, Microsoft YaHei-Regular;
    font-size: 14px;
    font-weight: 400;
    line-height: 24px;
    color: #373a3c;
    text-align: left;
  }
}
.cardBox_order {
  // height: 19px;
  width: 100%;
  font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  color: #373a3c;
  text-align: left;
}
.likeTables {
  display: flex;
  width: 100%;
  line-height: 25px;
  border-bottom: 1px solid #ddd;
  .one {
    width: 20%;
    text-align: center;
  }
  .two {
    width: 40%;
    text-align: center;
  }
  .three {
    width: 20%;
    text-align: center;
  }
  .four {
    width: 20%;
    text-align: center;
    white-space: nowrap;
  }
}
.shortcut {
  display: flex;
  font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  // width: 289px;
  // height: 41px;
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
  color: #373a3c;
  text-align: left;
  border-bottom: 1px solid #ddd;
  .shortcut_left {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 10%;
    margin: 0;
    /deep/ .el-radio__label {
      display: none;
    }
  }
}
.fontItem {
  font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  // margin:2px 10px
  font-size: 14px;
  font-weight: 400;
  color: #999;
  text-align: left;
  text-indent: 1em;
}
.tabs_content {
  /deep/ .el-tabs__content {
    height: 100%;
    padding: 15px 0;
    overflow: auto;
  }
  /deep/ .el-tabs__nav-scroll {
    .el-tabs__item {
      height: 40px;
      padding: 4px 8px;
      line-height: 30px;
      box-sizing: border-box;
    }

    width: 50px;
  }
}
.tableOrder {
  /deep/ .el-input__inner {
    padding: 0 8px;
  }
}
.footer {
  // position: absolute;
  // bottom: 0;
  // bottom: -5px;
  z-index: 2;
  display: flex;
  width: 100%;
  background-color: #fff;
  // padding: 5px;
  box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.16);
  box-sizing: border-box;
  .left {
    width: 70%;
  }
  .right_btns {
    display: flex;
    align-items: center;
    width: 30%;
    flex-direction: row-reverse;
    // justify-content: space-around;
  }
  .footer_form {
    display: flex;
    flex-wrap: wrap;
    & /deep/ .el-form-item {
      width: 20%;
      .el-form-item__content > .el-select {
        width: 100%;
      }
    }
    & /deep/ .el-form-item .yuyueriqi {
      width: 25%;
    }
    & /deep/ .el-form-item .yuyueshijian {
      width: 35%;
    }
  }
}
.orderForm {
  display: flex;
}
.Setiing {
  float: right;
  font-size: 18px;
  color: #01999F;
  &:hover {
    color: #989fc1;
  }
}
footer {
  padding: 5px;
  background-color: #F5F7FA !important;
  border-top: 1px solid rgb(229, 231, 242);
}
.moduletitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fastSearchstyle {
  /deep/ .el-input-group__prepend {
    background: #fff;
  }
}
</style>
